package com.rdgk.newtech.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.rdgk.newtech.dao.StatisticalDao;
import com.rdgk.newtech.service.StatisticalService;
import com.rdgk.newtech.util.CommonUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StatisticalServiceImpl implements StatisticalService {
    @Autowired
    private StatisticalDao dao;

    /**
     * 专家列表
     */
    @Override
    public JSONObject getAuthorList(JSONObject jsonObject) {
        CommonUtil.fillPageParam(jsonObject);
        int count = dao.countAuthor(jsonObject);
        List<JSONObject> list = dao.getAuthorList(jsonObject);
        return CommonUtil.successPage(jsonObject, list, count);
    }

    /**
     * 获取机构表列表
     */
    @Override
    public JSONObject getOrgList(JSONObject jsonObject) {
        CommonUtil.fillPageParam(jsonObject);
        int count = dao.countOrg(jsonObject);
        List<JSONObject> list = dao.getOrgList(jsonObject);
        return CommonUtil.successPage(jsonObject, list, count);
    }

    /**
     * 获取论文表列表
     */
    @Override
    public JSONObject getPaperList(JSONObject jsonObject) {
        CommonUtil.fillPageParam(jsonObject);
        int count = dao.countPaper(jsonObject);
        List<JSONObject> list = dao.getPaperList(jsonObject);
        return CommonUtil.successPage(jsonObject, list, count);
    }

    /**
     * 获取专利表列表
     */
    @Override
    public JSONObject getPatentList(JSONObject jsonObject) {
        CommonUtil.fillPageParam(jsonObject);
        int count = dao.countPatent(jsonObject);
        List<JSONObject> list = dao.getPatentList(jsonObject);
        return CommonUtil.successPage(jsonObject, list, count);
    }

    /**
     * 获取技术网络动态信息表列表
     */
    @Override
    public JSONObject getTechniqueArticleList(JSONObject jsonObject) {
        CommonUtil.fillPageParam(jsonObject);
        int count = dao.countTechniqueArticle(jsonObject);
        List<JSONObject> list = dao.getTechniqueArticleList(jsonObject);
        return CommonUtil.successPage(jsonObject, list, count);
    }

    /**
     * 获取热词表列表
     */
    @Override
    public JSONObject getHotWordsList(JSONObject jsonObject) {
        CommonUtil.fillPageParam(jsonObject);
        int count = dao.countHotWords(jsonObject);
        List<JSONObject> list = dao.getHotWordsList(jsonObject);
        return CommonUtil.successPage(jsonObject, list, count);
    }
}
